// 1. 导入 自定义好的 request 请求函数
import request from '../utils/request'

import store from '@/store'

// 2. 定义接口函数 - 首页 - 获取用户选择的频道
const getUserListApi = () => {
    return request({
        method: 'GET',
        url: '/v1_0/user/channels',
        headers: {
            Authorization: `Bearer ${store.state.token}`
        }
    })
}

// 首页 - 获取文章列表
const getArticleListAPI = ({ channelId, timestamp = Date.now() + '' }) => {
    return request({
        method: 'GET',
        url: '/v1_0/articles',
        params: {
            channel_id: channelId,
            timestamp
        }
    })
}
export {
    getUserListApi,
    getArticleListAPI
}